package com.scpii.api.common.auth.token;

import java.util.Collections;
import java.util.List;

import com.scpii.api.common.auth.ClientAuthentication;

public class TokenEnhancerChain implements TokenEnhancer {

	private List<TokenEnhancer> delegates = Collections.emptyList();

	public void setTokenEnhancers(List<TokenEnhancer> delegates) {
		this.delegates = delegates;
	}

	public AuthAccessToken enhance(AuthAccessToken accessToken,
			ClientAuthentication authentication) {
		AuthAccessToken result = accessToken;
		for (TokenEnhancer enhancer : delegates) {
			result = enhancer.enhance(result, authentication);
		}
		return result;
	}

}
